<?xml version="1.0" encoding="utf-8"?>
<Sonic>
  
  <!-- 
  A list of tools that can be used to process directories within the site.
  These are the main workers for the Sonic build tool.
  
  Also note that there is always a "Null" processor tool, which will iterate over all files but make no changes.
  The purpose of the "Null" tool is to allow ProcessorPlugins to execute.
  -->
	<ProcessorTools>
    <!-- HTML Tidy -->
    <Tool name="HtmlTidy" path="C:\SonicTest\Tools\tidy.exe">
      <Arguments>-m -i -asxhtml -utf8 ${input}</Arguments>
    </Tool>
    
    <!-- CSS Tidy -->
    <Tool name="CssTidy" path="C:\SonicTest\Tools\csstidy.exe">
			<Arguments>${input} --sort_properties=true --template=high ${output}</Arguments>
		</Tool>
    
    <!-- PNG Out - compress PNG colour spaces -->
    <Tool name="PngOut" path="C:\SonicTest\Tools\pngout.exe">
      <Arguments>${input} /y /q</Arguments>
    </Tool>
	</ProcessorTools>

  <!-- 
  ProcessorToolDirective (Plugins) can be run pre or post processor tool execution.
  They can do handy things like filtering file lists, renaming files, etc.  
  -->
  <ProcessorToolDirectives>
    <Directive name="DateStamp" type="Sonic.Framework.ProcessorToolDirectives.Default.DateStamper" path="C:\SonicTest\ExampleSite\plugins\Sonic.Framework.ProcessorToolDirectives.Default.dll" />
    <Directive name="FileNameFilter" type="Sonic.Framework.ProcessorToolDirectives.Default.FileNameFilter" path="C:\SonicTest\ExampleSite\pluginsSonic.Framework.ProcessorToolDirectives.Default.dll" />
    <Directive name="Concatenate" type="Sonic.Framework.ProcessorToolDirectives.Default.Concatenator" path="C:\SonicTest\ExampleSite\pluginsSonic.Framework.ProcessorToolDirectives.Default.dll" />
  </ProcessorToolDirectives>

  <!-- Define the site structure. This is the root of the published web site -->
  <Site path="C:\SonicTest\ExampleSite">
		<!-- Global exclusions -->
  	<Exclusions>
      <Exclusion type="ProcessorTool">
			  <Path scope="Directory">~\lists-excluded\</Path>
      </Exclusion>
		</Exclusions>
    
    <!-- Define a directory to process; in this case, the CSS directory which should be CssTidy'd -->
		<Directory processorTool="CssTidy" relativePath="~\css\" filePattern="*.css">
      <ProcessorToolDirectives>
        <!-- Plugin's to be executed before this processor tool runs -->
        <Pre>
          <!-- Ensure we don't reprocess date stamped file, and optionally delete old date stamped files before processing the CSS directory -->
          <Directive name="FileNameFilter" pattern="\d{6}\.css$" deleteMatchingFiles="true" />

          <!-- Concatenate a series of files together into one file -->
          <Directive name="Concatenate" output="~\out.css">
            <Path scope="Directory">~\global\whatisxero\</Path>
            <Path scope="File">~\file.css</Path>
          </Directive>
        </Pre>

        <!-- Plugin's to be executed after this processor tool runs -->
        <Post>
          <!-- Append a date stamp to the css file name. e.g. file.css -> file-081201.css -->
          <!--<Directive name="DateStamp" dateFormat="yymmDD" />-->
        </Post>
      </ProcessorToolDirectives>
      
      <!-- Files to be excluded by the processor -->
      <Exclusions>
        <Exclusion type="ProcessorTool">
          <Path scope="Directory">~\untidy.css</Path>
        </Exclusion>
      </Exclusions>
		</Directory>

    <!-- Process all the PNGs in a directory, compressing them with the PngOut tool which strips out unwanted color space info -->
    <Directory processorTool="PngOut" relativePath="~\img\" filePattern="*.png">
      <ProcessorToolDirectives>
        <!-- Plugin's to be executed before this processor tool runs -->
        <Pre>
        </Pre>

        <!-- Plugin's to be executed after this processor tool runs -->
        <Post>
        </Post>
      </ProcessorToolDirectives>
      
      <Exclusions>
        <Exclusion type="ProcessorTool">
          <Path scope="Directory">~\lists-excluded\</Path>
        </Exclusion>
      </Exclusions>
    </Directory>

    <!-- Tidy all the HTML files within the site -->
    <Directory processorTool="HtmlTidy" relativePath="~\pages\" filePattern="*.htm|*.html">
      <ProcessorToolDirectives>
        <!-- Plugin's to be executed before this processor tool runs -->
        <Pre>
        </Pre>

        <!-- Plugin's to be executed after this processor tool runs -->
        <Post>
        </Post>
      </ProcessorToolDirectives>

      <Exclusions>
        <Exclusion type="ProcessorTool">
          <Path scope="Directory">~\lists-excluded\</Path>
        </Exclusion>
      </Exclusions>
    </Directory>
    
    <!--
    This directory doesn't have a processor tool, but in this example it utilises ProcessorToolDirective's to rename filenames to ensure
    image files are cached on the next deployment.    
    -->
    <Directory processorTool="Null" relativePath="~\img\" filePattern="*.png|*.gif|*.bmp|*.jpg|*.jpeg">
      <ProcessorToolDirectives>
        <!-- Plugin's to be executed before this processor tool runs -->
        <Pre>
        </Pre>

        <!-- Plugin's to be executed after this processor tool runs -->
        <Post>
        </Post>
      </ProcessorToolDirectives>
      
      <Exclusions>
        <Exclusion type="ProcessorTool">
          <Path scope="Directory">~\img\uk\</Path>
        </Exclusion>
      </Exclusions>
    </Directory>
    
	</Site>
</Sonic>